using System;
using System.Windows.Controls;
using System.Windows.Media.Animation;

namespace TabControlLib.Tools
{
    public static class ScrollViewerExtensions
    {
        public static void ScrollToHorizontalOffsetWithAnimation(this ScrollViewer scrollViewer, double offset)
        {
            var animation = new DoubleAnimation
            {
                To = offset,
                Duration = TimeSpan.FromMilliseconds(200)
            };
            
            scrollViewer.BeginAnimation(ScrollViewer.HorizontalOffsetProperty, animation);
        }
    }
}
